<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../../commons/taglibs.jsp"%>
<%@ include file="../../commons/list.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta charset="utf-8">
  <title>车详情基本信息</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <style type="text/css">
  	.layui-input{
  		width: 400px;
  	}
  	.layui-form-pane .layui-form-label{
  		width: 200px;
  	}
  </style>
</head>

<body>

<div>
	<div style="padding: 50px;padding-top: 10px">
		<form class="layui-form layui-form-pane"  action="">
			<input type="hidden" id='entityId' name='entityId' value="${carDetailBaseInfo.id }">
			<input type="hidden" id='entityId' name='carmodelid' value="${carmodelid }">
			
			   <%--  <label class="layui-form-label">图片地址</label>
			    <div class="layui-input-block">
		      		<input type="text" name="img" id='img' value = "${carDetailBaseInfo.img }"   placeholder="请输入图片地址" autocomplete="off" class="layui-input">
		   		 </div> --%>
		   		 
	   		 <div class="layui-form-item">
			     <label class="layui-form-label">图片地址</label>
			     <div class="layui-input-inline">
			         <input type="text" name="img" id='imgAddress' placeholder="图片" value="${carDetailBaseInfo.img }" class="layui-input">
			     </div>
			 </div>
			 
			 <div class="layui-form-item">
			     <label class="layui-form-label">图片</label>
			     <div class="layui-input-inline">
			         <div class="layui-upload-list" style="margin:0">
			             <img src="<%=basePath%>/common/img/${carDetailBaseInfo.img }" id="img" height="100px" width="200px" class="layui-upload-img">
			         </div>
			     </div>
			     <div class="layui-input-inline layui-btn-container" style="width: auto;padding-left: 200px">
			         <a class="layui-btn layui-btn-primary" id="editimg1">修改图片</a >
			     </div>
			     <div class="layui-form-mid layui-word-aux" style="float: left;">头像的尺寸限定726x500px</div>
			 </div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">厂商</label>
			    <div class="layui-input-block">
		      		<input type="text" name="level" id='level' value = "${carDetailBaseInfo.level }"   placeholder="请输入厂商" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">级别</label>
			    <div class="layui-input-block">
		      		<input type="text" name="engine" id='engine' value = "${carDetailBaseInfo.engine }"   placeholder="请输入级别" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">发动机</label>
			    <div class="layui-input-block">
		      		<input type="text" name="gearbox" id='gearbox' value = "${carDetailBaseInfo.gearbox }"   placeholder="请输入发动机" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">变速箱</label>
			    <div class="layui-input-block">
		      		<input type="text" name="longhighwith" id='longhighwith' value = "${carDetailBaseInfo.longhighwith }"   placeholder="请输入变速箱" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">长*宽*高(mm)</label>
			    <div class="layui-input-block">
		      		<input type="text" name="bodystructure" id='bodystructure' value = "${carDetailBaseInfo.bodystructure }"   placeholder="请输入长*宽*高(mm)" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
		  
		  	<div class="layui-form-item">
			    <label class="layui-form-label">车身结构</label>
			    <div class="layui-input-block">
		      		<input type="text" name="maximumspeed" id='maximumspeed' value = "${carDetailBaseInfo.maximumspeed }"   placeholder="请输入车身结构" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">最高车速(km/h)</label>
			    <div class="layui-input-block">
		      		<input type="text" name="officialacceleration" id='officialacceleration' value = "${carDetailBaseInfo.officialacceleration }"   placeholder="请输入最高车速(km/h)" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">官方0-100km/h加速(s)</label>
			    <div class="layui-input-block">
		      		<input type="text" name="measuredacceleration" id='measuredacceleration' value = "${carDetailBaseInfo.measuredacceleration }"   placeholder="请输入官方0-100km/h加速(s)" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">实测100-0km/h制动(m)</label>
			    <div class="layui-input-block">
		      		<input type="text" name="measuredbrake" id='measuredbrake' value = "${carDetailBaseInfo.measuredbrake }"   placeholder="请输入实测100-0km/h制动(m)" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">实测油耗(L/100km)</label>
			    <div class="layui-input-block">
		      		<input type="text" name="measuredfuelconsumption" id='measuredfuelconsumption' value = "${carDetailBaseInfo.measuredfuelconsumption }"   placeholder="请输入实测油耗(L/100km)" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">车主平均油耗(L/100km)</label>
			    <div class="layui-input-block">
		      		<input type="text" name="averageconsumptionofcertification" id='averageconsumptionofcertification' value = "${carDetailBaseInfo.averageconsumptionofcertification }"   placeholder="请输入车主平均油耗(L/100km)" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">工信部综合油耗(L/100km)</label>
			    <div class="layui-input-block">
		      		<input type="text" name="ministryofintegratedfuelconsumption" id='ministryofintegratedfuelconsumption' value = "${carDetailBaseInfo.ministryofintegratedfuelconsumption }"   placeholder="请输入工信部综合油耗(L/100km)" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">实测离地间隙(mm)</label>
			    <div class="layui-input-block">
		      		<input type="text" name="measuredgroundclearance" id='measuredgroundclearance' value = "${carDetailBaseInfo.measuredgroundclearance }"   placeholder="请输入实测离地间隙(mm)" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
  			
  			<div class="layui-form-item">
			    <label class="layui-form-label">整车质保</label>
			    <div class="layui-input-block">
		      		<input type="text" name="vehiclequality" id='vehiclequality' value = "${carDetailBaseInfo.vehiclequality }"   placeholder="请输入整车质保" autocomplete="off" class="layui-input">
		   		 </div>
  			</div>
		  <div class="layui-form-item" style="width: 85%;padding-left: 150px;padding-top: 30px">
		    <div class="layui-input-block">
		      <button class="layui-btn" id='tjsub' lay-submit lay-filter="formDemo">立即提交</button>
		    </div>
		  </div>
		</form>
	</div>
 </div>
<script>

layui.config({
    base: '<%=basePath%>common/cropper/' 
    }).use(['form','croppers'], function () {
    var $ = layui.jquery
        ,form = layui.form
        ,croppers = layui.croppers
        ,layer= layui.layer;

    //创建一个头像上传组件
    croppers.render({
        elem: '#editimg1'
        ,saveW:600     //保存宽度
        ,saveH:402
        ,mark:14.925/10    //选取比例
        ,area:['700px', '600px']  //弹窗宽度
        ,offset: '50px'
        ,url: "<%=basePath%>controller/carDetailBaseInfo/uploadImg/"  //图片上传接口返回和（layui 的upload 模块）返回的JOSN一样
        ,done: function(url){ //上传完毕回调
            $("#imgAddress").val(url);
            $("#img").attr('src','<%=basePath%>/common/img/'+url);
        }
    });
    
     var form = layui.form;
	  
	  //监听提交
	  form.on('submit(formDemo)', function(data){
		  var field = JSON.parse(JSON.stringify(data.field));
		  var img = field.img;
		  field.img = $("#imgAddress").val();
	  	//提交成功后禁用按钮
		$("#tjsub").css("pointer-events","none"); 
	    //layer.msg(JSON.stringify(data.field));
	    $.post("<%=basePath%>/controller/carDetailBaseInfo/save",field,function (data){
	    	if(data == '0'){
	    		$("#tjsub").css("pointer-events","auto");
	    		layer.msg('提交成功', {time:1000}); 
	    		setTimeout("window.location.reload();",1500); 
	    	}else{
	    		$("#tjsub").css("pointer-events","auto");
	    		layer.msg('提交失败', {time:1000}); 
	    	}
	    })
	    return false;
	  });
    
});

</script>
</body>
</html>
